home *** CD-ROM | disk | FTP | other *** search
- <%@ page language="java" import="
- java.util.*,
- com.jproxy.site.mbeans.JMXInvocator,
- com.jproxy.site.mbeans.config.*,
- com.jproxy.site.ejbeans.interfaces.ISaleFormula,
- com.jproxy.site.*"
- errorPage="../error-page.jsp"
- %>
-
- <jsp:useBean id="buycustomers" scope="request" class="com.jproxy.site.customers.Buy"/>
- <%
- if (!buycustomers.ses.isLoggedIn()) {
- %>
- <jsp:forward page="login.jsp">
- </jsp:forward>
- <%
- }
- buycustomers.request(pageContext);
- buycustomers.ses.setNewHit(pageContext, "hits", "Customer Buy Page", null);
- %>
-
- <%
- if(buycustomers.forwardPage.length()>0)
- {
- %>
- <jsp:forward page="<%=buycustomers.forwardPage%>">
- </jsp:forward>
- <%
- }
- %>
-
- <%
- int purchasedLicenses = 0;
- if(buycustomers.getParameter("purchased-licenses").length()>0)
- purchasedLicenses = new Integer(buycustomers.getParameter("purchased-licenses")).intValue();
- String customerName = buycustomers.customer.getCustomerName();
- String host = "http://"+request.getServerName()+":"+request.getServerPort();
-
- boolean isDisabled = false;
- ISaleFormula formula = (ISaleFormula)buycustomers.formulas.elementAt(0);
-
- int firstLicensePrice = formula.getFirstLicense();
- int additionalLicensePrice = formula.getAdditionalLicense();
- if(purchasedLicenses>0)
- firstLicensePrice = additionalLicensePrice;
-
- int amount = firstLicensePrice;
- int licenses = 1;
- int customerId = 0;
- int invoice = 0;
-
- // find out the number of licenses requested
- if(request.getParameter("licenses")!=null)
- {
- try{
- licenses = new Integer(request.getParameter("licenses")).intValue();
- if (licenses <= 0)
- licenses = 1;
- }
- catch(Exception ee){}
- }
-
- // calculate the total amount based on the number of licenses and the pricing model
- amount = firstLicensePrice + additionalLicensePrice * (licenses - 1);
-
- if(request.getParameter("submit_recalculate")!=null)
- {
- }
- if(request.getParameter("submit_purchase")!=null && request.getParameter("error")==null)
- {
- %>
- <jsp:forward page="purchase.jsp"/>
- <%
- }
- %>
-
- <!-- HEADER -->
- <jsp:include page="../header.jsp" flush="true">
- <jsp:param name="name" value="Buy JProxy Tunnel"/>
- </jsp:include>
-
- <!-- MAIN PANEL -->
-
-
- <br>
- You're about to purchase licenses for your <span class="h9VerdanaBold"><%=customerName%></span> customer.
- <p>
- Once the payment is made the new total of purchased licenses will be altered in the Managing
- Console screen. Newly purchased licenses will be added to the total purchased licenses of this
- customer.
- <p>
- Please enter the number of host licenses you would like to purshase and click <b>Recalcualte</b> to get the updated price
- <p>
- <%
- if(isDisabled)
- {
- %>
- <blockquote>
- <p><b>Sorry, </b></p>
- <p><b>The page is under construction.</b></p>
- <p><b>E-Commerce is coming soon.</b></p>
- <p><b>Get free feature limited JProxy release <a href="download.html">here</a>.</b></p>
- </blockquote>
- <%
- }
- else
- {
-
- ConfigMBean mbean = (ConfigMBean)JMXInvocator.getMBean(
- "JProxy:service=JProxyConfigMBean", ConfigMBean.class);
- String productName = mbean.get("com.jproxy.proxy.name") + " " + mbean.get("com.jproxy.proxy.version");
- String invoiceStr = mbean.get("com.jproxy.commerce.invoice");
- try{
- invoice = Integer.parseInt(invoiceStr);
- }
- catch(Exception e){
- invoice = 15;
- }
- %>
- <br>
- <table class="h9Verdana" cellpadding="5" width="600" border="0">
- <!-- Prolog -->
- <tr>
- <td>
- <table class="h9Verdana" border="0" bgcolor="9c9cff" cellpadding="1" cellspacing="0">
- <tr><td>
- <%=productName%>
- </td></tr>
- <tr><td>
- <form method="get" action="buy.jsp">
- <table class="h8Verdana" border="0" bgcolor="white" cellpadding="5" cellspacing="1" width="100%">
- <tr>
- <td align="left">
- <br>
- Quantity:
- <input type="input" name="licenses" value="<%=licenses%>" size="3">
- <INPUT TYPE=HIDDEN NAME="customer-id" VALUE="<%=buycustomers.customerID%>">
- Licenses:
- <input type="text" name="total" READONLY value="$<%=amount%>" size="8">
- Technical Support:
- <input type="text" name="total" READONLY value="$<%=(amount * 0.25) %>" size="8">
- Order Total:
- <input type="text" name="total" READONLY value="$<%=(amount + amount * 0.25) %>" size="8">
- </td>
- </tr>
- <tr>
- <td class="h8Verdana" align="right">
- <INPUT TYPE=SUBMIT NAME=submit_recalculate WIDTH="20" VALUE="Recalculate">
- </td>
- </tr>
- </table>
- </form>
- <!-- begin separator -->
- </td></tr>
- <tr><td>
- <!-- end separator -->
- <table class="h8Verdana" width="100%" border="0" bgcolor="white" cellpadding="5" cellspacing="0" >
- <tr>
- <td align="left">
- When you're ready to proceed to a secure payment form
- please press the <b>Purchase</b> button
- </td>
- <td align="right">
- <br>
- <%
- String headerHTML = "<font size=30 color=#6331CE>JProxy</font>";
- headerHTML += "<font size=10 color=#9C00FF>.com</font>";
- String footerHTML = "<font size=2><em>Copyright 2001-2002, JProxy</em></font>";
- String description = "productName : "+productName+"<br>";
- description += "Customer Name : "+customerName+"<br>";
- description += "Licenses # : "+licenses;
- %>
- <FORM METHOD=POST ACTION="https://secure.authorize.net/gateway/transact.dll">
- <INPUT TYPE=HIDDEN NAME="number_of_licenses" VALUE="<%=licenses%>">
- <INPUT TYPE=HIDDEN NAME="customer-id" VALUE="<%=buycustomers.customerID%>">
- <INPUT TYPE=HIDDEN NAME="parent-id" VALUE="<%=buycustomers.ses.getLogin().getID()%>">
- <INPUT TYPE=HIDDEN NAME="x_amount" VALUE="<%=(amount + amount * 0.25)%>">
- <INPUT TYPE=HIDDEN NAME="x_Version" VALUE="3.0">
- <INPUT TYPE=HIDDEN NAME="x_Login" VALUE="jproxyllc">
- <INPUT TYPE=HIDDEN NAME="x_Show_Form" VALUE="PAYMENT_FORM">
- <INPUT TYPE=HIDDEN NAME="x_Cust_ID" VALUE="<%=customerId%>">
- <INPUT TYPE=HIDDEN NAME="x_Invoice_Num" VALUE="<%=invoice%>">
- <INPUT TYPE=HIDDEN NAME="x_Description" VALUE="<%=description%>">
- <!-- INPUT TYPE=HIDDEN NAME="x_Logo_URL" VALUE="http://jproxy.com/main/resources/jproxy.gif" -->
- <INPUT TYPE=HIDDEN NAME="x_Header_HTML_Payment_Form" VALUE="<%=headerHTML%>">
- <INPUT TYPE=HIDDEN NAME="x_Footer_HTML_Payment_Form" VALUE="<%=footerHTML%>">
- <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_Method" VALUE="GET">
- <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_Text" VALUE="Click here to continue">
- <INPUT TYPE=HIDDEN NAME="x_Receipt_Link_URL" VALUE="<%=host%>/main/customers/purchase.jsp;jsessionid=<%=request.getSession().getId()%>">
- <INPUT TYPE=SUBMIT NAME=submit_purchase WIDTH="20" VALUE="Purchase">
- </FORM>
- </td>
- </tr>
- </table>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- <%
- }
- %>
-
- <!-- FOOTER -->
- <jsp:include page="../footer.jsp" flush="true"/>
-